package com.example.stylecameraversion01;

import android.app.Activity;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.provider.MediaStore;
import android.widget.VideoView;

public class ActivityVideoCapture extends Activity {
	private static final int CAMERA_VIDEO_REQUEST = 1000;
	private VideoView videoView;

	public void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.layout_make_video);

		videoView = (VideoView) findViewById(R.id.videoView1);

		videoCapture();
	}

	private void videoCapture() {
		Intent videoIntent = new Intent(
				android.provider.MediaStore.ACTION_VIDEO_CAPTURE);

		videoIntent.putExtra(MediaStore.EXTRA_DURATION_LIMIT, 360000);
		videoIntent.putExtra(MediaStore.EXTRA_SIZE_LIMIT, 10240000);
		videoIntent.putExtra(MediaStore.EXTRA_VIDEO_QUALITY, 1);

		startActivityForResult(videoIntent, CAMERA_VIDEO_REQUEST);
	}

	@Override
	protected void onActivityResult(int requestCode, int resultCode, Intent data) {
		// TODO Auto-generated method stub
		if(requestCode==CAMERA_VIDEO_REQUEST){
			Uri uriVideo=data.getData();
			
			videoView.setVideoURI(uriVideo);
			videoView.requestFocus();
			videoView.start();
		}
	}
}
